package com.sywb.chuangyebao.bean;

import java.io.Serializable;

/**
 * 评论信息
 */
public class CommentReply implements Serializable {

    /**
     * "reply_id": 7,
     * "comment_id": 18,
     * "from_uid": 1,
     * "to_uid": 1,
     * "date_time": 213412,
     * "content": "test",
     * "thumb_count": 16603,
     * "is_thumb": true,
     * "from_user": {
     * "uid": 1,
     * "nickname": "",
     * "name": "",
     * "avatar_s": "",
     * "avatar_l": "",
     * "avatar_hd": "",
     * },
     * "reply_obj": {
     * "content": "test",
     * "to_user": {
     * "uid": 1,
     * "nickname": "",
     * "name": "",
     * "avatar_s": "",
     * "avatar_l": "",
     * "avatar_hd": "",
     * }
     */

    public int reply_id;// 回复ID
    public int comment_id;// 评论ID
    public int from_uid;// 回复者UID
    public int to_uid;// 回复目标UID
    public int date_time;// 评论时间（秒）
    public String content;// 评论内容
    public int reply_count;// 回复数
    public int thumb_count;// 点赞数
    public boolean is_thumb;// 当前用户是否点赞：true=是 false=否
    public NewsOwner from_user;// 评论者用户信息
    public CommentReplyObj reply_obj;// 回复目标，含目标用户信息

    public String getReplyCount() {
        if (reply_count > 0) {
            String replyCount;
            if (reply_count >= 10000) {
                java.text.DecimalFormat df = new java.text.DecimalFormat("#.0");
                replyCount = df.format(reply_count / 10000d) + "万";
            } else {
                replyCount = String.valueOf(reply_count);
            }
            return String.format("%s回复", replyCount);
        } else {
            return "回复";
        }
    }

    public String getThumbCount() {
        if (thumb_count > 0) {
            if (thumb_count >= 10000) {
                java.text.DecimalFormat df = new java.text.DecimalFormat("#.0");
                return df.format(thumb_count / 10000d) + "万";
            } else {
                return String.valueOf(thumb_count);
            }
        } else {
            return "点赞";
        }
    }

}
